package com.lwj.liwanjia.adapter;

import android.content.Context;

import com.lwj.liwanjia.R;
import com.lwj.liwanjia.bean.AddressBean;
import com.superrecycleview.superlibrary.adapter.BaseViewHolder;
import com.superrecycleview.superlibrary.adapter.SuperBaseAdapter;

import java.util.List;

/**
 * Created by Administrator on 2017/9/13.
 */

public class AddressAdapter extends SuperBaseAdapter<AddressBean.DataBean> {

    public AddressAdapter(Context context, List<AddressBean.DataBean> data) {
        super(context, data);
    }

    @Override
    protected void convert(BaseViewHolder holder, AddressBean.DataBean item, int position) {
        holder.setOnClickListener(R.id.tv_edit, new OnItemChildClickListener());
        holder.setOnClickListener(R.id.tv_delete, new OnItemChildClickListener());
        holder.setOnClickListener(R.id.ll_moren, new OnItemChildClickListener());
        if (item.getFist() == 0) {
            holder.setImageResource(R.id.iv_moren, R.mipmap.kuang);
        } else if (item.getFist() == 1) {
            holder.setImageResource(R.id.iv_moren, R.mipmap.kuang_1);
        }
        holder.setText(R.id.tv_name, item.getConsigneeName())
                .setText(R.id.tv_phone, item.getConsigneePhone())
                .setText(R.id.tv_detail_address, item.getConsigneeAddress());
    }

    @Override
    protected int getItemViewLayoutId(int position, AddressBean.DataBean item) {
        return R.layout.address_item;
    }
}
